include(CheckLanguage)
check_language(CXX)
if(CMAKE_CXX_COMPILER)
	if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
		set(host_only_warning_flags "-Wpedantic")
		set(warning_flags "-Wall" "-Wextra" "-Wpedantic" "-Wno-missing-field-initializers")
	elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
		set(host_only_warning_flags "-Wpedantic")
		set(warning_flags "-Wall" "-Wextra" "-Wno-missing-field-initializers")
	elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
		set(warning_flags "-w3" "-wd1418,2259")
	elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
		set(warning_flags "/W4")
	else ()
		message(WARNING "Unknown compiler - cannot set warning flags")
	endif()
	if(warning_flags)
		set(host_warning_flags ${host_only_warning_flags} ${warning_flags})
		foreach(flag ${host_warning_flags})
			add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${flag}>")
		endforeach()
	endif()
	check_language(CUDA)
	if (CMAKE_CUDA_COMPILER)
		foreach(flag ${warning_flags})
			add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:--compiler-options=${flag}>")
		endforeach()
	endif()
endif()


